
#include "stdafx.h"
#include <io.h>
#include "DDXray.h"
#include "Public.h"
#include "DlgTool.h"
#include "PanImage.h"
#include "DD_ImgCfg.h"
#include "DlgMsgBox.h"
#include "FolderDialog.h"
#include "DlgIntegralTimes.h"
#include "DlgDenoiserParam.h"
#include "DlgSysProductInfo.h"

#include "DlgSysAdjustment.h"
#include "DlgSysBadPixelAdjustment.h"
#include "DlgMarkBadPixel.h"


void CDlgTool::OnBnClickedCheckStartmanualcheck()
{
	BOOL bEnable = ((CButton*)GetDlgItem(IDC_CHECK_StartManualCheck))->GetCheck();
	GetDlgItem(IDC_CHECK_Qualified)->EnableWindow(bEnable);
	GetDlgItem(IDC_CHECK_UnQualified)->EnableWindow(bEnable);
	GetDlgItem(IDC_CHECK_NoCheck)->EnableWindow(bEnable);
	GetDlgItem(IDC_RADIO_Point)->EnableWindow(bEnable);
	GetDlgItem(IDC_RADIO_Unit)->EnableWindow(bEnable);

	g.SysConfigParam2.cManuCheckAuto = bEnable ;
	WriteCfgFile((void*)&g.SysConfigParam2,sizeof(g.SysConfigParam2),"SysConfigParam2.bin");
}

void CDlgTool::OnBnClickedCheckQualifiedcheck()
{
	BOOL bEnable = ((CButton*)GetDlgItem(IDC_CHECK_Qualified))->GetCheck();
	g.SysConfigParam2.cAutoCheckQualification = bEnable ;
	WriteCfgFile((void*)&g.SysConfigParam2,sizeof(g.SysConfigParam2),"SysConfigParam2.bin");
}


void CDlgTool::OnBnClickedCheckUnQualifiedcheck()
{
	BOOL bEnable = ((CButton*)GetDlgItem(IDC_CHECK_UnQualified))->GetCheck();
	g.SysConfigParam2.cAutoCheckDisqualification = bEnable ;
	WriteCfgFile((void*)&g.SysConfigParam2,sizeof(g.SysConfigParam2),"SysConfigParam2.bin");
}
void CDlgTool::OnBnClickedCheckNoCheckcheck()
{
	BOOL bEnable = ((CButton*)GetDlgItem(IDC_CHECK_NoCheck))->GetCheck();
	g.SysConfigParam2.cAutoCheckNotRecognize = bEnable ;
	WriteCfgFile((void*)&g.SysConfigParam2,sizeof(g.SysConfigParam2),"SysConfigParam2.bin");
}
void CDlgTool::OnBnClickedCheckPointcheck()
{
	BOOL bEnable = ((CButton*)GetDlgItem(IDC_RADIO_Point))->GetCheck();
	g.SysConfigParam2.cAutoCheckPerPoint = bEnable ;
	WriteCfgFile((void*)&g.SysConfigParam2,sizeof(g.SysConfigParam2),"SysConfigParam2.bin");
}
void CDlgTool::OnBnClickedCheckUnitcheck()
{
	BOOL bEnable = ((CButton*)GetDlgItem(IDC_RADIO_Unit))->GetCheck();
	g.SysConfigParam2.cAutoCheckPerPoint = bEnable ? 0 : 1;
	WriteCfgFile((void*)&g.SysConfigParam2,sizeof(g.SysConfigParam2),"SysConfigParam2.bin");
}


void CDlgTool::OnBnClickedCheckDefectImage()
{
	g.SysConfigParam2.cDefectImage = ((CButton*)GetDlgItem(IDC_CHECK_DefectImage))->GetCheck();
	WriteCfgFile((void*)&g.SysConfigParam2,sizeof(g.SysConfigParam2),"SysConfigParam2.bin");

	g.ViewmAnaly[eAnalyWindow_Sub]->DDOnDraw();
}
void CDlgTool::OnBnClickedCheckEdgeImage()
{
	g.SysConfigParam2.cEdgeImage = ((CButton*)GetDlgItem(IDC_CHECK_EdgeImage))->GetCheck();
	WriteCfgFile((void*)&g.SysConfigParam2,sizeof(g.SysConfigParam2),"SysConfigParam2.bin");

	g.ViewmAnaly[eAnalyWindow_Sub]->DDOnDraw();
}
void CDlgTool::OnBnClickedCheckKeyRect()
{
	g.SysConfigParam2.cKeyRect = ((CButton*)GetDlgItem(IDC_CHECK_KeyRect))->GetCheck();
	WriteCfgFile((void*)&g.SysConfigParam2,sizeof(g.SysConfigParam2),"SysConfigParam2.bin");

	g.ViewmAnaly[eAnalyWindow_Sub]->DDOnDraw();
}